package com.trio.zjq.utils;

import java.security.SecureRandom;
import java.util.UUID;

/**
 * 生成各种唯一性主键的工具类.
 *
 * @author 张俊强~.
 * @date 2017/11/21-16:38.
 */
public final class IDUtils {

    private static SecureRandom random = new SecureRandom();

    private IDUtils(){
        throw new AssertionError();
    }

    /**
     * 通过JDK自带的UUID生猪唯一性主键(去除'-')
     * */
    public static String uuid(){
        return UUID.randomUUID().toString().replace("-","");
    }

    /**
     * 使用SecureRandom随机生成唯一性主键
     */
    public static long randomLong(){
        return  Math.abs(random.nextLong());
    }



}
